package edu.spec.xhd.helloworld;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import edu.spec.xhd.R;


public class ActivityOne extends AppCompatActivity{

    private static final String TAG = "ActivityOne";

    private Button buttonVerbose;
    private Button buttonDebug;
    private Button buttonInfo;
    private Button buttonWarn;
    private Button buttonError;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_one);
        initViews();
        initListeners();
    }

    /**
     * 初始化活动里面的视图组件
     */
    private void initViews(){
        buttonVerbose = findViewById(R.id.btn_verbose);
        buttonDebug = findViewById(R.id.btn_debug);
        buttonInfo = findViewById(R.id.btn_info);
        buttonWarn = findViewById(R.id.btn_warn);
        buttonError = findViewById(R.id.btn_error);
    }

    /**
     * 初始化监听器（点击事件）
     */
    private void initListeners(){

        buttonVerbose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.v(TAG, "verbose");
            }
        });
        buttonDebug.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Log.d(TAG, "debug");
            }
        });
        buttonInfo.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Log.i(TAG, "info");
            }
        });
        buttonWarn.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Log.w(TAG, "warn");
            }
        });
        buttonError.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Log.e(TAG, "error");
            }
        });

    }

}
